import CryptoJS from 'crypto-js';
var key = "1592978527842WZH"; //秘钥
var iv = "852ddc13b5ab968e"; //向量


// 加密
export function Encrypt(text) {
	let n = CryptoJS.AES.encrypt(text, CryptoJS.enc.Utf8.parse(key), {
		iv: CryptoJS.enc.Utf8.parse(iv),
		mode: CryptoJS.mode.CBC,
		padding: CryptoJS.pad.Pkcs7
	})

	console.log(n);
	return n.toString();
}


//解密方法
export function Decrypt(text) {
	let result = CryptoJS.AES.decrypt(text, CryptoJS.enc.Utf8.parse(key), {
		iv: CryptoJS.enc.Utf8.parse(iv),
		mode: CryptoJS.mode.CBC,
		padding: CryptoJS.pad.Pkcs7
	});
	let n = result.toString(CryptoJS.enc.Utf8)
	return n.toString();
}
